<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>练习12.08</title>
	<script type="text/javascript">
/*
   创建一个Person构造函数
*/
		function Person(name,age,gender){
			this.name=name;
			this.age=age;
			this.gender=gender;
			//向对象中添加一个方法
//			this.sayName=fun;
			}
		/*function fun(){
				alert("Hello"+this.name);
		};*/
		//向原型中添加sayName方法
		Person.prototype.sayName=function(){
			alert("Hello"+this.name);
		}
		
		//创建一个Person实例
		var per = new Person("王新茹","18","女");
		var per2 = new Person("白骨精","18","女");
		per.sayName();
		per2.sayName();
		
	</script>
</head>
<!--prototype:是什么？怎么用？-->
<body>
</body>
</html>
